package cn.org.xuanzp.common.command;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * @Classname Command
 * @Description 命令接口
 * @Version 1.0.0
 * @Date 2024/9/21 23:24
 * @Created by xuanzp
 */
public abstract class Command<T> implements Serializable {

    private Map<String,Object> headers =  new HashMap<String, Object>();


    /***
     * 获取操作类型
     * @return
     */
    public abstract CommandType getType();

    /***
     * 请求头
     * @return
     */
    public Map<String, Object> getHeaders(){
        return headers;
    };

    /***
     * 请求载荷
     * @return
     * @param <T>
     */
    public <T extends Payload> T getPayload(){
        return (T) new Payload(){};
    }

    public void setHeaders(Map<String, Object> headers) {
        this.headers = headers;
    }


}
